package com.ruoyi.echarts.mapper;

import com.ruoyi.echarts.domain.ActivitySign;
import com.ruoyi.echarts.domain.BookStore;
import com.ruoyi.echarts.domain.OrdersNum;
import com.ruoyi.echarts.domain.Post;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface EchartsMapper {
    @Select("select book_name,sum(num) as total from orders_item GROUP BY book_name ORDER BY total desc limit 5")
    public List<OrdersNum> echart1();

    @Select("select count(*) as num,activity.name as activity_name from sign join activity on sign.activity_id=activity.id GROUP BY sign.activity_id")
    public List<ActivitySign> echart2();

    @Select("select count(*) as num,posts_section.name from posts join posts_section on posts.section_id=posts_section.id GROUP BY posts.section_id")
    public List<Post> echart3();

    @Select("select name,store as num from book")
    public List<BookStore> echart4();
}
